package com.application.outdoor.InvoikeServices;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import android.util.Log;

import com.application.Network.Protocol;

public class LogThaoTacInvoike extends BaseInvoike {
	
	public LogThaoTacInvoike(){
		super();
		url+="/LogThaoTacServlet";
	}
	public void insert(String nguoiDung,String ghiChu, int idCay, int loai){
		final ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.UPLOAD));
		params.add(new BasicNameValuePair(Protocol.NGUOI_DUNG, nguoiDung));
		params.add(new BasicNameValuePair(Protocol.GHI_CHU, ghiChu));
		params.add(new BasicNameValuePair(Protocol.ID_CAY, idCay+""));
		params.add(new BasicNameValuePair(Protocol.MSG_TYPE, loai+""));
		try {
			Thread t=new Thread(new Runnable() {
				
				@Override
				public void run() {
					try{
					post(url, params);
					}catch (Exception e) {
						Log.e(Protocol.TAG,"LogThaoThacInvoike.insert1"+e.getMessage());
					}
				}
			});
			t.start();
		} catch (Exception e) {
			Log.e(Protocol.TAG,"LogThaoThacInvoike.insert"+e.getMessage());
		}
	}
	public String get(int idCay){
		String rs="";
		ArrayList<NameValuePair> params=new ArrayList<NameValuePair>();
		params.add(new BasicNameValuePair(Protocol.CMD, Protocol.DOWNLOAD));
		params.add(new BasicNameValuePair(Protocol.ID_CAY, idCay+""));
		try {
			rs=post(url, params);
		} catch (Exception e) {
			Log.e(Protocol.TAG,"LogThaoThacInvoike.insert"+e.getMessage());
			rs="";
		}
		return rs;
	}
}
